package com.dajie.pt.entity.base;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * DAO接口.
 * 
 * @author dajie
 * 
 * @param <E>
 *            对应的Entity的Class
 * @param <PK>
 *            主键Class
 */
public interface EntityDao<E, PK extends Serializable>
{

	Object getById(PK id);

	void deleteById(PK id);

	void deleteBy(Object... params);

	void delete(Collection<PK> ids);

	Object save(E entity);

	Object saveWithLog(Object logInfo, E entity);

	int update(E entity);

	int updateWithLog(Object logInfo, E entity);

	void saveOrUpdate(E entity);

	void saveOrUpdateWithLog(Object logInfo, E entity);

	boolean isUnique(E entity, String uniquePropertyNames);

	boolean isPropertyUnique(String property, String orgValue, String newValue);

	List<E> findAll();

	List<E> findBy(final Object... params);

	List<E> findByMap(Map map);

	E findUniqueBy(final Object... params);

	void flush();

	void deleteByWithLog(Object logInfo, final Object... params);

}
